
#include <stdio.h>
#include <assert.h>

#include "str_hash_table.h"


static void add_adm_unit_entries(struct HashTable * ht)
{
    // adm unit entries are as follows:
    hash_table_add_len(ht, "ADM1");
    hash_table_add_len(ht, "ADM2");
    hash_table_add_len(ht, "ADM3");
    hash_table_add_len(ht, "ADM4");
    hash_table_add_len(ht, "ADMD");
    hash_table_add_len(ht, "LTER");
    hash_table_add_len(ht, "PCL");
    hash_table_add_len(ht, "PCLD");
    hash_table_add_len(ht, "PCLF");
    hash_table_add_len(ht, "PCLI");
    hash_table_add_len(ht, "PCLIX");
    hash_table_add_len(ht, "PCLS");
    hash_table_add_len(ht, "PRSH");
    hash_table_add_len(ht, "TERR");
    hash_table_add_len(ht, "ZN");
    hash_table_add_len(ht, "ZNB");
}

static void test_ht()
{
    struct HashTable * ht = create_hash_table();

    add_adm_unit_entries(ht);

    fprintf(stdout, "hash table test\n");

    assert(hash_table_contains_len(ht, "ADM1"));
    assert(hash_table_contains_len(ht, "ADM2"));
    assert(hash_table_contains_len(ht, "ADM3"));
    assert(hash_table_contains_len(ht, "ZN"));

    assert(!hash_table_contains_len(ht, "ADM5"));
    assert(!hash_table_contains_len(ht, "ADM"));
    assert(!hash_table_contains_len(ht, "DAM3"));

    free_hash_table(ht);
}

void test_import1()
{
    test_ht();
}
